package com.java.grammer.arrays;

import java.util.Scanner;

/**
 * @author luzhikun
 * @date 2020/11/28- 20:02
 */
public class Array_Test5 {
    public static void main(String[] args) {
        double[] a = new double[6];
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < a.length; i++) {
            System.out.println("请输入第" + (i + 1) + "个 学生成绩");
            double b = sc.nextDouble();
            a[i] = b;
        }
        double sum1 = 0;
        double sum2 = 0;
        double d = 0;
        double e = 0;
        for (int i = 0; i < a.length; i++) {
            if (i <= 2) {
                sum1 += a[i];
                d = sum1 / 3;
            } else if (i > 2 && i < 6) {
                sum2 += a[i];
                e = sum2 / 3;
            }
        }
        System.out.println("第一个班成绩总和为：" + sum1 + "  平均成绩为：" + d);
        System.out.println("第二个班级成绩总和为：" + sum2 + "  平均成绩为：" + e);
    }
}
